//
//  YWHotListTableViewCell.m
//  聆听FM
//
//  Created by dllo on 16/6/12.
//  Copyright © 2016年 Dark. All rights reserved.
//

#import "YWHotListTableViewCell.h"

@implementation YWHotListTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.photoImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:_photoImageView];
        
        self.titleLabel = [[UILabel alloc] init];
        _titleLabel.font = [UIFont systemFontOfSize:15];
        _titleLabel.textColor = [UIColor whiteColor];
        [self.contentView addSubview:_titleLabel];
        
        self.firstTitleLabel = [[UILabel alloc] init];
        _firstTitleLabel.font = [UIFont systemFontOfSize:13];
        _firstTitleLabel.textColor = [UIColor colorWithWhite:1 alpha:0.6];
        [self.contentView addSubview:_firstTitleLabel];
        
        self.secondTitleLabel = [[UILabel alloc] init];
        _secondTitleLabel.font = [UIFont systemFontOfSize:13];
        _secondTitleLabel.textColor = [UIColor colorWithWhite:1 alpha:0.6];
        [self.contentView addSubview:_secondTitleLabel];
        
        self.arrowImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:_arrowImageView];
        
        self.lineLabel = [[UILabel alloc] init];
        _lineLabel.backgroundColor = [UIColor colorWithWhite:1 alpha:0.5];
        [self.contentView addSubview:_lineLabel];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    _photoImageView.frame = CGRectMake(15 * FITWIDTH, 15 * FITHEIGHT, 80 * FITWIDTH, 80 * FITHEIGHT);
    _titleLabel.frame = CGRectMake(_photoImageView.bounds.size.width + 30 * FITWIDTH, _photoImageView.frame.origin.y - 5 * FITWIDTH, 200 * FITWIDTH, 30 * FITHEIGHT);
    _firstTitleLabel.frame = CGRectMake(_titleLabel.frame.origin.x, _titleLabel.bounds.size.height + 25 * FITHEIGHT, 200 * FITWIDTH, 15 * FITHEIGHT);
    _secondTitleLabel.frame = CGRectMake(_titleLabel.frame.origin.x, _titleLabel.bounds.size.height + 50 * FITHEIGHT, 200 * FITWIDTH, 15 * FITHEIGHT);
    _arrowImageView.frame = CGRectMake(SCREENWIDTH - 40, 45 * FITHEIGHT, 20 * FITWIDTH, 20 * FITHEIGHT);
    _lineLabel.frame = CGRectMake(100 * FITWIDTH, self.bounds.size.height - 1, SCREENWIDTH - 100 * FITWIDTH, 1);
    
}

- (void)setListModel:(YWProgramListModel *)listModel
{
    if (_listModel != listModel) {
        _listModel = listModel;
        [_photoImageView sd_setImageWithURL:[NSURL URLWithString:listModel.coverPath] placeholderImage:[UIImage sd_animatedGIFNamed:@"占位图"]];
        _titleLabel.text = listModel.title;
        _firstTitleLabel.text = [NSString stringWithFormat:@"1  %@", [[listModel.firstKResults objectAtIndex:0] title]];
        _secondTitleLabel.text = [NSString stringWithFormat:@"2  %@", [[listModel.firstKResults objectAtIndex:1] title]];
        _arrowImageView.image = [UIImage imageNamed:@"向右"];
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
